# Contributor: Nicolas Lorin <androw95220@gmail.com>
# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=electrs
pkgver=0.9.7
pkgrel=1
pkgdesc="Efficient re-implementation of Electrum Server in Rust"
url="https://github.com/romanz/electrs"
license="MIT"
arch="all !s390x !riscv64" # limited by rust/cargo
makedepends="cargo rocksdb-dev clang-libs"
source="https://github.com/romanz/electrs/archive/v$pkgver/electrs-$pkgver.tar.gz
	10-rocksdb.patch
	11-rocksdb-locked.patch
	12-db.rs.patch
	"

build() {
	ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --all --features "metrics_process" --release --locked
}

check() {
	cargo test --all --release --locked
}

package() {
	install -Dm755 target/release/$pkgname -t "$pkgdir"/usr/bin
}

sha512sums="
9dd2df7b3af106b813a875f5c2140b4dce1824dd671430299df7cb9b7e02f4fe21ac4289f7d2cb711d30d4912b57a19a5543b7ced30e822448392d3513398cc1  electrs-0.9.7.tar.gz
485af61ccc59e987b1ce024ea02ef3917bb31a4e2cbd2bc55fe70042a1331dc5d6a884eff021db0106e9d900ac46755e71381e77ecdc3a896189597fb04b060f  10-rocksdb.patch
6509c7492bd577c96f17a61ed97422f5928ec8d0b3d317ded8f8331d45dd735152df9c4125f99ceda001484089f39e90748fa5c899198109139ebf3d4294aead  11-rocksdb-locked.patch
255f917bd0ba8fb7377676a25222528f6c6ebbfa114d3ae1fbfaafd6a68c2c849865a3eab8ff029bb7877924aa2a95dba0d39ebbd4936b6af44e990db467cc58  12-db.rs.patch
"
